package controllers

import (
	"chat/utils/response"
	"log"
	"net/http"

	"github.com/dgrijalva/jwt-go"
)

func GetToken(w http.ResponseWriter, r *http.Request) {
	token := jwt.New(jwt.GetSigningMethod("HS256"))
	tokenString, err := token.SigningString()
	if err != nil {
		log.Fatal(err)
	}
	resp := response.New(http.StatusOK, tokenString, "")
	w.Write(resp)
}
